package com.czd.support.service;

import com.czd.base.model.Paginate;
import com.czd.base.service.BaseService;
import com.czd.support.common.Configuration;
import com.czd.support.model.Advertisement;
import org.springframework.stereotype.Service;

/**
 * Created with IntelliJ IDEA.
 * Author: zhangrui
 * Create: zhangrui (2014-11-25 12:28)
 * Description:
 * To change this template use File | Settings | File Templates.
 */
@Service
public class AdvertisementService extends BaseService<Advertisement> {
	
	public Paginate queryForPaginate(Advertisement advertisement){
		advertisement.setPageSize(Configuration.getInstance().getDefault_page_size());
        return this.queryForPaginate(sqlId("queryForPaginate"),advertisement);
    }

    public boolean insert(Advertisement advertisement){
        return this.insertAndReturnId(sqlId("insert"), advertisement) > 0;
    }

    public Advertisement findById(int id) {
        return this.selectOne(sqlId("findById"),id);
    }

    public boolean update(Advertisement advertisement) {
        return this.update(sqlId("update"),advertisement);
    }

    public boolean deleteById(int id){
        return  this.delete(sqlId("deleteById"),id);
    }
}
